{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "2\n",
      "[[1010, 404], [2424, 1010], [3838, 1616]]\n"
     ]
    }
   ],
   "source": [
    "A = [[1, 2, 10, 20],\n",
    "[3, 4, 30, 40],\n",
    "[5, 6, 50, 60]]\n",
    "B = [[4, 2],\n",
    "[3, 1],\n",
    "[40, 20],\n",
    "[30, 10]]\n",
    "# 定义全 0 矩阵 C 用来存放结果\n",
    "C = [[0, 0],\n",
    "[0, 0],\n",
    "[0, 0]]\n",
    "\n",
    "c_row = 0\n",
    "c_column = 0\n",
    "b_row_num = len(B)\n",
    "print(b_row_num)\n",
    "b_column_num = len(B[0])\n",
    "print(b_column_num)\n",
    "for n in range(len(A)):\n",
    "    for i in range(b_column_num):\n",
    "        for j in range(b_row_num):\n",
    "            C[n][i]+=A[n][j]*B[j][i]\n",
    "\n",
    "print(C)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
